<%@ page import="java.util.*" %>
<%@ page import="com.czxy.demo01.User" %><%--
  Created by IntelliJ IDEA.
  User: 宝贝嘉燕
  Date: 2021/9/25
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    List<Integer>list=new ArrayList<>();
    Collections.addAll(list,  10,20,30,40,50,60);
    pageContext.setAttribute("list",list);
%>
<h1>获取到的数据是：${list}</h1>
<h1>获取到的数据是：${list[3]}</h1>

<%
    Map<String,String>map=new HashMap<>();
    map.put("k1","张三");
    map.put("k2","李四");
    map.put("k3","王五");

    pageContext.setAttribute("map",map);

%>
<h1>获取map数据：${map}</h1>
<h1>获取map数据：${map.k2}</h1>

<%
Map<String, User>mapU=new HashMap<>();
mapU.put("k1",new User("张三","123",10));
mapU.put("k2",new User("李四","456",11));
mapU.put("k3" +
        "",new User("王五","789",12));

pageContext.setAttribute("mapU",mapU);
%>

<h1>mapU=${mapU}</h1>
<h1>k1对应的value ： ${mapU.k1}</h1>
<h1>k2对应的value的  username属性： ${mapU.k2.username}</h1>

</body>
</html>
